﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace HamcoWcs.DAL.Migrations
{
    public partial class A18 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "FromLoc",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "ToLoc",
                table: "main_task_bak");

            migrationBuilder.AddColumn<DateTime>(
                name: "CompleteTime",
                table: "sub_task_bak",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "完成时间");

            migrationBuilder.AddColumn<DateTime>(
                name: "SendTime",
                table: "sub_task_bak",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "任务下发时间");

            migrationBuilder.AddColumn<DateTime>(
                name: "StartTime",
                table: "sub_task_bak",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "开始时间");

            migrationBuilder.AlterColumn<DateTime>(
                name: "StartTime",
                table: "sub_task",
                type: "datetime(6)",
                nullable: false,
                comment: "开始时间",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CompleteTime",
                table: "sub_task",
                type: "datetime(6)",
                nullable: false,
                comment: "完成时间",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)");

            migrationBuilder.AddColumn<DateTime>(
                name: "SendTime",
                table: "sub_task",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "任务下发时间");

            migrationBuilder.AlterColumn<string>(
                name: "UnitId",
                table: "main_task_bak",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "条码号",
                oldClrType: typeof(string),
                oldType: "varchar(30)",
                oldMaxLength: 30,
                oldComment: "条码号")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "TaskId",
                table: "main_task_bak",
                type: "varchar(50)",
                maxLength: 50,
                nullable: false,
                comment: "任务号",
                oldClrType: typeof(string),
                oldType: "varchar(30)",
                oldMaxLength: 30,
                oldComment: "任务号")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "Sender",
                table: "main_task_bak",
                type: "varchar(30)",
                maxLength: 30,
                nullable: false,
                comment: "发送方：WMS/WCS/MES...",
                oldClrType: typeof(string),
                oldType: "varchar(30)",
                oldMaxLength: 30,
                oldComment: "发送方：WMS\\WCS")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CompleteTime",
                table: "main_task_bak",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "完成时间");

            migrationBuilder.AddColumn<string>(
                name: "CurrentMachine",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "当前设备")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "CurrentPosition",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "当前位置")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "CurrentType",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "当前设备类型")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "CurrentZone",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "当前区域")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "DesMachine",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "目的地设备名")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "DesPosition",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "目的地位置")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<int>(
                name: "DesPriority",
                table: "main_task_bak",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "目的地优先级");

            migrationBuilder.AddColumn<string>(
                name: "DesType",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "目的地类型")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "DesZone",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "目的地区域")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "InventoryInfo",
                table: "main_task_bak",
                type: "text",
                maxLength: 100,
                nullable: true,
                comment: "盘点信息")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<int>(
                name: "IsReportStart",
                table: "main_task_bak",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "是否向MES上报开始，0未上报，1已上报");

            migrationBuilder.AddColumn<int>(
                name: "IsTimeout",
                table: "main_task_bak",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "是否超时");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastPriorityUpdateTime",
                table: "main_task_bak",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "上次更新优先级的时间");

            migrationBuilder.AddColumn<string>(
                name: "MaterialInfo",
                table: "main_task_bak",
                type: "text",
                maxLength: 100,
                nullable: true,
                comment: "物料信息")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OldDesMachine",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "旧目的地设备名")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OldDesPosition",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "旧目的地位置")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OldDesType",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "旧目的地类型")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OldDesZone",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "旧目的地区域")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Path",
                table: "main_task_bak",
                type: "varchar(200)",
                maxLength: 200,
                nullable: true,
                comment: "路径")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "ReadyTime",
                table: "main_task_bak",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "准备完成时间");

            migrationBuilder.AddColumn<string>(
                name: "SrcMachine",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "起始地设备名")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "SrcPosition",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "起始地位置")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<int>(
                name: "SrcPriority",
                table: "main_task_bak",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "起始地优先级");

            migrationBuilder.AddColumn<string>(
                name: "SrcType",
                table: "main_task_bak",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "起始地类型")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "SrcZone",
                table: "main_task_bak",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "起始地区域")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "StartTime",
                table: "main_task_bak",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "开始时间");

            migrationBuilder.AddColumn<string>(
                name: "TransactionId",
                table: "main_task_bak",
                type: "varchar(20)",
                maxLength: 20,
                nullable: true,
                comment: "MES下发任务是的TransactionId")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<DateTime>(
                name: "StartTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                comment: "开始时间",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CompleteTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                comment: "完成时间",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)");

            migrationBuilder.AddColumn<string>(
                name: "CurrentMachine",
                table: "main_task",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "当前设备")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "CurrentPosition",
                table: "main_task",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "当前位置")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "CurrentType",
                table: "main_task",
                type: "varchar(10)",
                maxLength: 10,
                nullable: true,
                defaultValue: "",
                comment: "当前设备类型")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "CurrentZone",
                table: "main_task",
                type: "varchar(15)",
                maxLength: 15,
                nullable: true,
                defaultValue: "",
                comment: "当前区域")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastPriorityUpdateTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "上次更新优先级的时间");

            migrationBuilder.AddColumn<DateTime>(
                name: "ReadyTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "准备完成时间");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "CompleteTime",
                table: "sub_task_bak");

            migrationBuilder.DropColumn(
                name: "SendTime",
                table: "sub_task_bak");

            migrationBuilder.DropColumn(
                name: "StartTime",
                table: "sub_task_bak");

            migrationBuilder.DropColumn(
                name: "SendTime",
                table: "sub_task");

            migrationBuilder.DropColumn(
                name: "CompleteTime",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "CurrentMachine",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "CurrentPosition",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "CurrentType",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "CurrentZone",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "DesMachine",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "DesPosition",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "DesPriority",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "DesType",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "DesZone",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "InventoryInfo",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "IsReportStart",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "IsTimeout",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "LastPriorityUpdateTime",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "MaterialInfo",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "OldDesMachine",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "OldDesPosition",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "OldDesType",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "OldDesZone",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "Path",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "ReadyTime",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "SrcMachine",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "SrcPosition",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "SrcPriority",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "SrcType",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "SrcZone",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "StartTime",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "TransactionId",
                table: "main_task_bak");

            migrationBuilder.DropColumn(
                name: "CurrentMachine",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "CurrentPosition",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "CurrentType",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "CurrentZone",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "LastPriorityUpdateTime",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "ReadyTime",
                table: "main_task");

            migrationBuilder.AlterColumn<DateTime>(
                name: "StartTime",
                table: "sub_task",
                type: "datetime(6)",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "开始时间");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CompleteTime",
                table: "sub_task",
                type: "datetime(6)",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "完成时间");

            migrationBuilder.AlterColumn<string>(
                name: "UnitId",
                table: "main_task_bak",
                type: "varchar(30)",
                maxLength: 30,
                nullable: false,
                comment: "条码号",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "条码号")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "TaskId",
                table: "main_task_bak",
                type: "varchar(30)",
                maxLength: 30,
                nullable: false,
                comment: "任务号",
                oldClrType: typeof(string),
                oldType: "varchar(50)",
                oldMaxLength: 50,
                oldComment: "任务号")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "Sender",
                table: "main_task_bak",
                type: "varchar(30)",
                maxLength: 30,
                nullable: false,
                comment: "发送方：WMS\\WCS",
                oldClrType: typeof(string),
                oldType: "varchar(30)",
                oldMaxLength: 30,
                oldComment: "发送方：WMS/WCS/MES...")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "FromLoc",
                table: "main_task_bak",
                type: "varchar(30)",
                maxLength: 30,
                nullable: true,
                comment: "起点")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "ToLoc",
                table: "main_task_bak",
                type: "varchar(30)",
                maxLength: 30,
                nullable: true,
                comment: "终点")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<DateTime>(
                name: "StartTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "开始时间");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CompleteTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "完成时间");
        }
    }
}
